<h1>Docker commit 命令</h1>
<p><strong>docker commit :</strong>从容器创建一个新的镜像。</p>
<h3>语法</h3>
<pre><code class="language-Docker">docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]</code></pre>
<p>OPTIONS说明：</p>
<ul>
<li><p><strong>-a :</strong>提交的镜像作者；</p><p></p></li>
<li><p><strong>-c :</strong>使用Dockerfile指令来创建镜像；</p><p></p></li>
<li><p><strong>-m :</strong>提交时的说明文字；</p><p></p></li>
<li><p><strong>-p :</strong>在commit时，将容器暂停。</p><p></p></li>
</ul>
<h3>实例</h3>
<p>将容器a404c6c174a2  保存为新的镜像,并添加提交人信息和说明信息。</p>
<pre><code class="language-Docker">runoob@runoob:~$ docker commit -a "runoob.com" -m "my apache" a404c6c174a2  mymysql:v1 

sha256:37af1236adef1544e8886be23010b66577647a40bc02c0885a6600b33ee28057

runoob@runoob:~$ docker images mymysql:v1

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

mymysql             v1                  37af1236adef        15 seconds ago      329 MB

</code></pre>
